Skip to content

Clarified \g and \k backreferences in Boost regex. - #897

Merged
pryrt merged 2 commits into
notepad-plus-plus:masterfrom
pbarney:pbarney-backreference-clarification-1
Aug 21, 2026
Merged

pryrt merged 2 commits into
notepad-plus-plus:masterfrom
pbarney:pbarney-backreference-clarification-1

Conversation

@pbarney

@pbarney pbarney commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

According to Boost's source code, \g and \k backreferences are synonymous. This edit removes any ambiguity that may remain in the reader's mind regarding when to use one or the other.

Fixes #896

According to Boost's source code, \g and \k backreferences are synonymous. This edit removes any ambiguity that may remain in the reader's mind regarding when to use one or the other.
@pryrt pryrt added the needs improvement will not be accepted until improvements are made label Aug 17, 2026
@pryrt

pryrt commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

If you must clarify these, then do it as a subpoint to the already existing bullet point, don't put your "caveat" before those symbols are defined.

Comment thread content/docs/searching.md Outdated

* `(?<name>`_subset_`)` or `(?'name'`_subset_`)` ⇒ _Named Capture Group_: Names the value matched by _subset_ as the group _name_. Please note that group names are case-sensitive.

* `\g` and `\k` are functionally synonymous prefixes for _extended backreferences._ There is no semantic difference in Boost's implementation. They coexist for syntax-compatibility/historical reasons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be moved down... I would say move it after the For negative ℕ a few paragraphs down, and make it have the same indentation as that note.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Please let me know if I misunderstood your placement request.

Removed redundant explanation of backreference prefixes and clarified their usage in the context of regex.
@pryrt pryrt added accepted and removed needs improvement will not be accepted until improvements are made labels Aug 21, 2026
@pryrt
pryrt merged commit 5b0df3f into notepad-plus-plus:master Aug 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SEARCHING] Difference between \g and \k is not addressed.

2 participants